<?php
declare (strict_types=1);

namespace app\admin\validates;

use think\Validate;

/**
 * IntegralTask验证器
 */
class IntegralTaskValidate extends Validate
{
    /**
     * 验证规则
     * @var array
     */
    protected $rule = [
        'id' => 'require|number',
        'name' => 'require|max:255',
        'type' => 'require|number',
        'bonus_points' => 'require|number',
        'jump_url' => 'requireIf:type,1|requireIf:type,4|requireIf:type,5|max:2000',
        'official_id' => 'requireIf:type,2|max:255',
        'mini_jump_url' => 'requireIf:type,3|max:2000',
        'enabled' => 'require|number',
        'num' => 'require|number',
    ];

    /**
     * 验证场景
     * @var array
     */
    protected $scene = [
        'edit' => ['id', 'name', 'type', 'bonus_points', 'jump_url','mini_jump_url','official_id'],
        'add' => ['name', 'type', 'bonus_points', 'jump_url','mini_jump_url','official_id'],
        'enabled' => ['enabled', 'id'],
    ];


}